jQuery.extend({
	checkDelete_job: function(confirm_msg,url,jobCode){
		if(window.confirm(confirm_msg)){
			jQuery.jsonGet({
				url:url,
				jsonStatusSuccessCall:function(msg,data){
					   if(data==1){
						   if(window.confirm(msg)){
							   jQuery.delete_job(jobCode);
						   }else{
							   return;
						   }
					   }else{
						   alert(msg);
						   jQuery.refresh();//刷新界面
					   }
			    },
			    jsonStatusFailCall:function(msg){
					  alert(msg); 
			    }
			});
		}
	},
	
	delete_job: function(jobCode){
			jQuery.jsonGet({
				url:_ctx+"/uums/delete_job_info/"+jobCode+".do",
				jsonStatusSuccessCall:function(msg,data){
					   alert(msg);
					   jQuery.refresh();//刷新界面
			    },
			    jsonStatusFailCall:function(msg){
					  alert(msg); 
			    }
			});
		
	},
	/**
	 * 显示复选框中选择的用户列表
	 */
	showSel: function(checkbox){
		var $checkbox = $(checkbox);
		var id = $checkbox.val();
		var name=$checkbox.attr("relname");//?获取姓名
		var selDiv = $("#selectedDiv");
		
		//"<input type='radio' name='selUser' id='"+id+"' />"+
		var cont = "<label for='"+id+"'>"+name+"</label>"+
			  	   "<img id='img"+id+"' src='"+_ctx+"/images/delete.gif' title='停用人员'  height='9' width='9' onclick='javascript:$.delSel(\""+id+"\");'/>";
		if($checkbox.is(":checked")){
			selDiv.append(cont);
		}else{
	    	$("input#"+id).remove();
	    	$("label[for='"+id+"']").remove();
	    	$("img#img"+id).remove();
		}
    },
    /**
     * 删除所选用户，并且设置对应checkbox选中状态
     */
    delSel: function(id){
    	var chkBoxs = $("input[name='ids']");
    	for(var i=0; i<chkBoxs.length; i++){
    		if(chkBoxs[i].value == id){
    			$(chkBoxs[i]).attr("checked",false);
    			break;
    		}
    	}
    	
    	$("input#"+id).remove();
    	$("label[for='"+id+"']").remove();
    	$("img#img"+id).remove();
    },
    /**
     * 返回设置结果
     */
    rtn: function(){
    	var result = new Object();
    	userCode="";
    	var allRadio = $("input[name='ids']");
    	for(var i=0; i<allRadio.length; i++){
    		userCode += $(allRadio[i]).val()+",";
    	}
    	userCode = userCode.substring(0, userCode.length-1);
    	result.userCode = userCode;
		window.returnValue = result;
		window.close();
    },
		
    /**
    * 取消后直接关闭窗口
    */
    console: function(){
    	window.close();
    }
	
});
